home *** CD-ROM | disk | FTP | other *** search
/ Adventure Games / Adventure Games 1.iso / panic / panic.exe / panic.DXR / 00245_Scripts.ls < prev    next >
Encoding:
Text File  |  1995-08-24  |  2.4 KB  |  117 lines

  1. on ReallyWantToLeave
  2.   global xWindow
  3.   sound stop 1
  4.   sound stop 2
  5.   showMiaW()
  6.   if objectp(xWindow) then
  7.     tell xWindow
  8.       go(label("Start"))
  9.     end tell
  10.     pause()
  11.   end if
  12. end
  13.  
  14. on showMiaW
  15.   global xWindow
  16.   if objectp(xWindow) then
  17.     open(xWindow)
  18.   else
  19.     set xWindow to window "YesNo"
  20.     set the rect of xWindow to getCenteredRect(352, 208)
  21.     set the fileName of xWindow to "YesNo.DIR"
  22.     set the titleVisible of xWindow to 0
  23.     set the modal of xWindow to 1
  24.     open(xWindow)
  25.   end if
  26. end
  27.  
  28. on hideMiaW
  29.   global xWindow
  30.   if objectp(xWindow) then
  31.     close(xWindow)
  32.   else
  33.     do("nothing")
  34.   end if
  35. end
  36.  
  37. on lose
  38.   global xWindow
  39.   if objectp(xWindow) then
  40.     forget(xWindow)
  41.   end if
  42. end
  43.  
  44. on getCenteredRect theRectWidth, theRectHeight
  45.   set theRectLeft to (the stageRight / 2) - (theRectWidth / 2)
  46.   set theRectTop to (the stageBottom / 2) - (theRectHeight / 2)
  47.   return rect(theRectLeft, theRectTop, theRectLeft + theRectWidth, theRectTop + theRectHeight)
  48. end
  49.  
  50. on replyYes
  51.   hideMiaW()
  52.   go("Start", "MainMenu.DIR")
  53. end
  54.  
  55. on replyNo
  56.   hideMiaW()
  57.   continue()
  58. end
  59.  
  60. on checkKeyDown
  61.   set userKey to the key
  62.   if (userKey >= "0") and (userKey <= "9") then
  63.     set the soundLevel to value(userKey)
  64.   end if
  65. end
  66.  
  67. on checkKeyEvent whichKey, whichKeyCode
  68.   if the commandDown then
  69.     if whichKey = "Q" then
  70.       showMiaW()
  71.       quit()
  72.     else
  73.       pass()
  74.       exit
  75.     end if
  76.   else
  77.     if whichKeyCode = 27 then
  78.       showMiaW()
  79.       quit()
  80.     else
  81.       if (whichKey = "?") or (whichKey = "/") then
  82.         exit
  83.       else
  84.         if whichKey = "S" then
  85.           set the soundEnabled to not (the soundEnabled)
  86.           exit
  87.         else
  88.           if (whichKey >= "0") and (whichKey <= "9") then
  89.             set the soundEnabled to 1
  90.             set newVolume to value(whichKey) * 28
  91.             set the volume of sound 1 to newVolume
  92.             set the volume of sound 2 to newVolume
  93.             exit
  94.           else
  95.             if whichKeyCode = 29 then
  96.               exit
  97.             else
  98.               if whichKeyCode = 28 then
  99.                 exit
  100.               else
  101.                 if whichKeyCode = 30 then
  102.                   exit
  103.                 else
  104.                   if whichKeyCode = 31 then
  105.                     exit
  106.                   end if
  107.                 end if
  108.               end if
  109.             end if
  110.           end if
  111.         end if
  112.       end if
  113.     end if
  114.   end if
  115.   dontPassEvent()
  116. end
  117.